#include "copydialog.h"

CopyDialog::CopyDialog(QWidget *parent) :
    QWidget(parent)
{
    copyButton = new QPushButton("Copy");
    txtEdit = new QTextEdit;
    vb = new QVBoxLayout;

    vb->addWidget(copyButton);
    vb->addWidget(txtEdit);

    setLayout(vb);

    setWindowModality(Qt::WindowModal);
    setWindowFlags(Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);

    connect(copyButton,SIGNAL(clicked()),this,SLOT(copyBase64Text()));
}

void CopyDialog::loadData(const QString& data)
{
    txtEdit->setText(data);
    setVisible(true);
}

void CopyDialog::copyBase64Text()
{
    qApp->clipboard()->setText(txtEdit->toPlainText());
}
